package lab01;

/**
 * Created by Administrator on 2017/10/9.
 */
public class Test05 {
    public static void main(String[] args) {
        int i=1;
        int n=1000;
        int sum=0;
        /*
        //for循环求和
        for(i=1;i<=n;i++){
            sum+=i;
        }
        System.out.println(sum);
    }*/
        //while循环求和
        /*while(i<=n){
            sum+=i;
            i++;
        }
        System.out.println(sum);
        //do while循环求和*/
        do{
            sum+=i;
            i++;
        }
        while(i<=n);
        System.out.println(sum);
    }
}
